'use strict';
var l = Object.defineProperty;
var p = (e, t, r) =>
  t in e
    ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r })
    : (e[t] = r);
var s = (e, t, r) => (p(e, typeof t != 'symbol' ? t + '' : t, r), r);
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const o = require('../nodes/identity.cjs'),
  h = require('./common/map.cjs'),
  O = require('./common/seq.cjs'),
  m = require('./common/string.cjs'),
  n = require('./tags.cjs'),
  f = (e, t) => (e.key < t.key ? -1 : e.key > t.key ? 1 : 0);
class a {
  constructor({
    compat: t,
    customTags: r,
    merge: g,
    resolveKnownTags: u,
    schema: c,
    sortMapEntries: i,
    toStringDefaults: y,
  }) {
    s(this, 'compat');
    s(this, 'knownTags');
    s(this, 'merge');
    s(this, 'name');
    s(this, 'sortMapEntries');
    s(this, 'tags');
    s(this, 'toStringOptions');
    (this.compat = Array.isArray(t)
      ? n.getTags(t, 'compat')
      : t
        ? n.getTags(null, t)
        : null),
      (this.merge = !!g),
      (this.name = (typeof c == 'string' && c) || 'core'),
      (this.knownTags = u ? n.coreKnownTags : {}),
      (this.tags = n.getTags(r, this.name)),
      (this.toStringOptions = y ?? null),
      Object.defineProperty(this, o.MAP, { value: h.map }),
      Object.defineProperty(this, o.SCALAR, { value: m.string }),
      Object.defineProperty(this, o.SEQ, { value: O.seq }),
      (this.sortMapEntries = typeof i == 'function' ? i : i === !0 ? f : null);
  }
  clone() {
    const t = Object.create(
      a.prototype,
      Object.getOwnPropertyDescriptors(this),
    );
    return (t.tags = this.tags.slice()), t;
  }
}
exports.Schema = a;
